package PTA_03_09;

import java.util.Scanner;

public class s1 {
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] arr = new int[N];
        for (int i = 0; i < N; i++)
        {
            arr[i] = sc.nextInt();
            if(isp(arr[i]))
            {
                System.out.println("Yes");
            }
            else
            {
                System.out.println("No");
            }
        }
    }

    public static boolean isp(int a)
    {
        if(a == 1)
        {
            return false;
        }
        else {
            for (int i = 2; i < a; i++) {
                if(a % i == 0)
                {
                    return false;
                }
            }
        }
        return true;
    }
}
